diff --git a/README.md b/README.md index 5beec8d..78e6906 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ To use this class, you need to create translation files with your translated str ```ini greeting = "Hello World!" +last_modified = "Last modified: %1$s!" +stringwithvars = "Hello %1$s! Last modified: %2$s!" [category] somethingother = "Something other..." @@ -40,6 +42,8 @@ somethingother = "Something other..." ```ini greeting = "Hallo Welt!" +last_modified = "Letzte Änderung: %1$s!" +stringwithvars = "Hallo %1$s! Letzte Änderung: %2$s!" [category] somethingother = "Etwas anderes..." @@ -132,6 +136,9 @@ In this example, we use the translation string seen in step 1. echo L::last_modified("today"); // Could be: 'Last modified: today' + + echo L::stringwithvars("world", "today"); + // Could be: 'Hello world! Last modified: today' echo L($string); // Outputs a dynamically chosen static property diff --git a/example.php b/example.php index 13c3750..8560d12 100644 --- a/example.php +++ b/example.php @@ -16,4 +16,12 @@

A greeting:

-

Something other:

\ No newline at end of file + + +

Last modified:

+ + +

A string with 2 variables:

+ + +

Something other:

\ No newline at end of file diff --git a/lang/lang_de.ini b/lang/lang_de.ini index 1690620..9179421 100644 --- a/lang/lang_de.ini +++ b/lang/lang_de.ini @@ -1,4 +1,6 @@ greeting = "Hallo Welt!" +last_modified = "Letzte Änderung: %1$s!" +stringwithvars = "Hallo %1$s! Letzte Änderung: %2$s!" [category] somethingother = "Etwas anderes..." \ No newline at end of file diff --git a/lang/lang_de.json b/lang/lang_de.json index 246c4a0..7b3b295 100644 --- a/lang/lang_de.json +++ b/lang/lang_de.json @@ -1,5 +1,7 @@ { "greeting": "Hallo Welt!", + "last_modified": "Letzte Änderung: %1$s!", + "stringswithvars": "Hallo %1$s! Letzte Änderung: %2$s!", "category": { "somethingother": "Etwas anderes..." } diff --git a/lang/lang_de.yml b/lang/lang_de.yml index c1f227e..0268707 100644 --- a/lang/lang_de.yml +++ b/lang/lang_de.yml @@ -1,4 +1,6 @@ greeting: 'Hallo Welt!' +last_modified: 'Letzte Änderung: %1$s!' +stringswithvars: 'Hallo %1$s! Letzte Änderung: %2$s!' category: somethingother: 'Etwas anderes...' \ No newline at end of file diff --git a/lang/lang_en.ini b/lang/lang_en.ini index 7282b1e..de8ce4f 100644 --- a/lang/lang_en.ini +++ b/lang/lang_en.ini @@ -1,4 +1,6 @@ greeting = "Hello World!" +last_modified = "Last modified: %1$s!" +stringwithvars = "Hello %1$s! Last modified: %2$s!" [category] somethingother = "Something other..." \ No newline at end of file diff --git a/lang/lang_en.json b/lang/lang_en.json index 5b28297..baeee40 100644 --- a/lang/lang_en.json +++ b/lang/lang_en.json @@ -1,5 +1,7 @@ { "greeting": "Hello World!", + "last_modified": "Last modified: %1$s!", + "stringswithvars": "Hello %1$s! Last modified: %2$s!", "category": { "somethingother": "Something other..." } diff --git a/lang/lang_en.yml b/lang/lang_en.yml index e1dbd83..593fb1e 100644 --- a/lang/lang_en.yml +++ b/lang/lang_en.yml @@ -1,4 +1,6 @@ greeting: 'Hello World!' +last_modified: 'Last modified: %1$s!' +stringswithvars: 'Hello %1$s! Last modified: %2$s!' category: somethingother: 'Something other...' \ No newline at end of file